
// #ifndef VUE3
import Vue from 'vue'
import App from './App';
import axios from 'utils/axios.js';
import store from './store/store.js'

Vue.config.productionTip = false

// 处理uniapp适配问题
import buildURL from 'axios/lib/helpers/buildURL'
import settle from 'axios/lib/core/settle'
axios.defaults.adapter = function(config) {
	return new Promise((resolve, reject) => {
		uni.request({
			method: config.method.toUpperCase(),
			url: config.baseURL + buildURL(config.url, 
			config.params, config.paramsSerializer),
			header: config.headers,
			data: config.data,
			dataType: config.dataType,
			responseType: config.responseType,
			sslVerify: config.sslVerify,
			complete: function complete(response) {
				response = {
					data: response.data,
					status: response.statusCode,
					errMsg: response.errMsg,
					header: response.header,
					config: config
				};
				settle(resolve, reject, response);
			}
		})
	})
}

Vue.prototype.$axios = axios;

// 使用uView
import uView from "uview-ui";
Vue.use(uView);

App.mpType = 'app'

const app = new Vue({
    ...App,
    store
})
app.$mount()

// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
import App from './App.vue'
export function createApp() {
  const app = createSSRApp(App)
  return {
    app
  }
}
// #endif